package entities;

import java.awt.Color;

public class MyColor{

	public int value;
	
	public MyColor() {
		value = -1;
	}
	
    public MyColor(Color c) {
    	
    	float[] hsb = new float[3];		// HSB: hue, saturation, brightness
    	hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsb);
    	if (hsb[0] < 0.01) 
    	{
			if (hsb[1] < 0.05)
			{
				if (hsb[2] < 0.74)
				{
					value = 9;
				}
				else
				{
					value = 0;
				}
			}
			else
			{
				value = 10;
			}
		} 
    	else if (hsb[0] < 0.09) 
    	{
    		value = 8;
		}
    	else if (hsb[0] < 0.11)
    	{
    		value = 3;
    	}
    	else if (hsb[0] < 0.18)
    	{
    		value = 7;
    	}
    	else if (hsb[0] < 0.34)
    	{
    		value = 5;
    	}
    	else if (hsb[0] < 0.51)
    	{
    		value = 2;
    	}
    	else if (hsb[0] < 0.61)
    	{
    		value = 1;
    	}
    	else
    	{
    		if (hsb[1] < 0.37)
    		{
    			value = 4;
    		}
    		else
    		{
    			value = 6;
    		}
    	}
//    	System.out.println(
//    			"H:" + hsb[0] + " " + 
//    			"S:" + hsb[1] + " " + 
//    			"B:" + hsb[2]);
//    	System.out.println(
//    			"R:" + c.getRed() + " " +
//    			"G:" + c.getGreen() + " " +
//    			"B:" + c.getBlue());
    }
}
